<template>
  <div>
    <el-form
      v-model="list"
      label-width="auto"
      style="max-width: 600px;margin-top: 10px">
      <el-form-item
        label="姓名"
        prop="id"
      >
        <el-input
          v-model="this.cons.realName"
          disabled="disabled"
          type="text"
          autocomplete="off"
        />
      </el-form-item>

      <el-form-item
        label="申请时间"
        prop="date"
      >
        <el-date-picker
          v-model="list.applicationDate"
          type="date"
        />
      </el-form-item>

      <el-form-item
        label="归还时间"
        prop="date"
      >
        <el-date-picker
          v-model="list.applicationDate"
          type="date"
        />
      </el-form-item>


      <el-form-item
        label="部门">
        <el-input
          v-model="list.deptName"
          disabled="disabled"
          type="text"
        />
      </el-form-item>


      <el-form-item
        label="图书编号"
        prop="transactionprice"
      >
        <el-input
          v-model="list.deptName"
          disabled="disabled"
          type="text"
        />
      </el-form-item>

      <el-form-item
        label="图书原因"
        prop="purchasingprice"
      >
        <el-input
          v-model="list.reason"
          type="textarea"
          autocomplete="off"
        />
      </el-form-item>

      <el-form-item
        label="下一步审批人"
        prop="purchasingprice"
      >
        <el-input
          v-model="list.manager"
          disabled="disabled"
          type="text"
        />
      </el-form-item>

      <el-form-item>
        <el-button type="danger" @click="submitForm()">保存</el-button>
        <el-button @click="qx()">返回</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import {queryDepartment} from "@/api/sealManagement/table";

export default {

  data() {
    return {
      list: [],
      cons: JSON.parse(con.get("SET_USERS"))
    }
  },
  created() {
    this.fetchData();
  },
  methods: {
    fetchData() {
      console.log(this.cons)
      queryDepartment(this.cons.realName).then(response => {
        console.log(response)
        this.list = response.data[0]
        console.log(this.list)
      })
    },
    // submitForm(){
    //   console.log(this.list)
    //   var date = new Date(this.list.applicationDate);
    //   this.list.applicationDate = date.getFullYear() + "-"
    //     + (date.getMonth() + 1) + "-" + date.getDate() + " "
    //     + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds()
    //   this.list.userID = this.cons.userID
    //   submitForm(this.list).then(data => {
    //     if (data.data.result) {
    //       alert("新增成功")
    //     } else {
    //       alert("新增失败")
    //     }
    //     window.location.reload();
    //   })
    // }
  }
}
</script>

